#include <iostream>
#include <vector>
using namespace std;

using ll = int;
int n, m;
int nums[100005];

int lowbit(int x)
{
	return x & (-x);
}

void add(int i, ll v)
{
	while (i <= n) {
		nums[i] += v;
		i += lowbit(i);
	}
}

ll sum(int i)
{
	ll ans = 0;
	while (i > 0) {
		ans += nums[i];
		i -= lowbit(i);
	}
	return ans;
}

ll query(int l, int r)
{
	return sum(r) - sum(l - 1);
}

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(nullptr);

	ll v = 0;
	cin >> n >> m;

	for (int i = 1; i <= n; i++) {
		cin >> v;
		add(i, v);
	}

	ll r = 0;
	for (int i = 0, op, l; i < m; i++) {
		cin >> op >> l >> r;
		if (op == 0) {
			cout << query(l, r) << '\n';
		} else {
			add(l, r);
		}
	}

	return 0;
}